<%@ page language="java" contentType="text/html;charset=utf-8" pageEncoding="utf-8" %>
<!DOCTYPE HTML>
<html>

<head>
    <title>施工编辑</title>
</head>
<body>
<style>
    form div {
        white-space: nowrap;
    }
    .anchorBL {
        display: none;
    }
</style>


<div id="right" style='float:right;width:70%;height:99%;border-left:2px ridge;overflow: hidden'>


    <div id="digroadmap" style="width:99%;height:99%">

    </div>

</div>

<div id="left" style='width:30%;height:99%;'>
    <div>
        <form id='registerform' action="<%=request.getContextPath()%>/back/digroad/edit.do?id=${digInfo.id}" method="post"

              class="form form-horizontal">


            <div class="row c1" style="padding-top: 50px">
                <label class="form-label col-3"><span class="c-red">*</span>施工编号：</label>

                <div class="formControls col-8 inline">
                    <input type="text" class="input-text" id="licencenum" name="licencenum" nullmsg="编号信息不能为空！">
                </div>
            </div>
            <div class="row c1" style="padding-top: 50px">
                <label class="form-label col-3">开工时间：</label>

                <div class="formControls col-8">
                    <input ignore="ignore" id="startTime" name='constructstarttime' class="Wdate input-text"
                           onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'%y-%M-%d'})"/>
                </div>
                <%--   <div class="col-9"></div>--%>
            </div>
            <div class="row c1" style="padding-top: 50px">
                <label class="form-label col-3">完工时间：</label>

                <div class="formControls col-8">
                    <input ignore="ignore" id="overTime" name='constructovertime' class="Wdate input-text"
                           onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'%y-%M-%d'})"/>
                </div>
                <%--   <div class="col-3"></div>--%>
            </div>

            <div class="row c1" style="padding-top: 50px">
                <label class="form-label col-3">施工类型：</label>

                <div class="formControls col-8">
              <span class="select-box">
              <select class="select" size="1" name="digtype" id="digtype">
                  <option value="掘路" selected>掘路</option>
                  <option value="占路">占路</option>
              </select>
            </span>
                </div>
            </div>

            <div class="row c1" style="padding-top: 50px">
                <label class="form-label col-3">地址：</label>

                <div class="formControls col-8">
                    <input ignore="ignore" type="text" class="input-text" id="roadname" name="roadname">
                </div>
                <%--   <div class="col-4"></div>--%>
            </div>
            <div class="row c1" style="padding-top: 50px;display:none;">
                <label class="form-label col-3">地图经度：</label>

                <div class="formControls col-8">
                    <input ignore="ignore" type="text" class="input-text" id="lng" name="lng">
                </div>
                <%--   <div class="col-4"></div>--%>
            </div>
            <div class="row c1" style="padding-top: 50px;display:none;">
                <label class="form-label col-3">地图维度：</label>

                <div class="formControls col-8">
                    <input ignore="ignore" type="text" class="input-text" id="lat" name="lat">
                </div>
                <%--   <div class="col-4"></div>--%>
            </div>
            <div class="row c1" style="padding-top: 50px">
                <label class="form-label col-3"><span class="c-red">*</span>施工原因：</label>

                <div class="formControls col-8 inline">
                    <input type="text" class="input-text" id="digmessage"
                           name="digmessage" datatype="*" nullmsg="原因不能为空"><br/>
                </div>
            </div>


            <div class="row c1" style="padding-top:65px">
                <div class="col-6 col-offset-3">

                    <button class="btn btn-primary radius" id="submitBtn"> 确定</button>
                    &nbsp;&nbsp;&nbsp;
                    <button class="btn  radius" type='reset'> 重置</button>
                    &nbsp;&nbsp;&nbsp;
                </div>
            </div>
        </form>
    </div>
</div>
</body>
</html>
<%@include file="../../head-ui.jsp" %>
<script type="text/javascript" src="<%=request.getContextPath()%>/resources/js/public/mapObj.js"></script>
<script type="text/javascript">


    $(function () {
        var mapObj = new MapEditor("digroadmap", null)
        var lng = parseFloat(${digInfo.lng});
        var lat = parseFloat(${digInfo.lat});
        if (isNaN(lng)) {
            lng = 121.43302
        }
        if (isNaN(lat)) {
            lat = 31.224598
        }
        point = new BMap.Point(lng, lat)
        mapObj.map.centerAndZoom(point, 18);  // 初始化地图,设置中心点坐标和地图级别
        mapObj.map.setCurrentCity("上海");          // 设置地图显示的城市 此项是必须设置的
        mapObj.map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放
        var marker = new BMap.Marker(point);// 创建标注
        mapObj.map.addOverlay(marker);
        marker.enableDragging();
        marker.addEventListener("dragend", function (e) {
            layer.confirm('是否保存当前点的位置？', {
                btn: ['确定','取消'] //按钮
            }, function(){
                $("#lng").val(e.point.lng);
                $("#lat").val(e.point.lat);
                layer.msg('坐标已变更', {icon: 1});
            }, function(){
                layer.close();
            });
        })
        $("#licencenum").val('${digInfo.licencenum}')
        $("#startTime").val('${digInfo.constructstarttime}');
        $("#overTime").val('${digInfo.constructovertime}');
        $("#roadname").val('${digInfo.roadname}');
        $("#digtype").val('${digInfo.digtype}');
        $("#digmessage").val('${digInfo.digmessage}');
        $("#lng").val('${digInfo.lng}');
        $("#lat").val('${digInfo.lat}');
        var form = $("#registerform").Validform({
            tiptype: 3,
            callback: function (data) {

                if (data.message == "false") {
                    layer.msg('保存失败!', {icon: 1, time: 1000});

                } else {
                    layer.alert('保存成功!', {
                        icon: 1,//2表示保存失败图标，1表示保存成功
                        closeBtn: false,
                        shadeClose: true,
                        title: "提示"
                    }, function () {

                        layer_close();
                    });
                    //layer.msg('保存成功!',{icon: 1,time:1000});
                    $("#uuid").val(data.uuid);
                }
            },
            ajaxPost: true,
            showAllError: true

        });

        $("#submitBtn").click(function () {
            form.submitForm(false);
        })
    })


    /*
     function digroad_save(){
     $.ajax({
     url: '<%--<%=request.getContextPath()%>--%>/back/digroad/updateRoadPark.do',
     type: 'POST',
     data:  "licencenum="+ $('#licencenum').val()+"&constructstarttime="
     +$('#startTime').val()+"&constructovertime="+
     $('#overTime').val()+"&roadname="+$('#roadname').val()
     +"&digtype="+ $('#digtype').val()
     +"&lng="+$('#lng').val()+"&lat="+ $('#lat').val()+"&id="+<%--${user.id},--%>
     success: function () {
     layer.alert('保存成功!', {
     icon: 1,//2表示保存失败图标，1表示保存成功
     closeBtn: false,
     shadeClose: true,
     title: "提示"
     }, function (index) {

     layer.close(index)
     });
     }
     })
     }
     */

</script>
<script type="text/javascript" src="<%=request.getContextPath()%>/resources/js/util.js"></script>

